Skip to content

Introduce UTF Analyzers and resolve diagnostics - #45

Merged
nowsprinting merged 4 commits into
masterfrom
utfanalyzers
Sep 26, 2026
Merged

nowsprinting merged 4 commits into
masterfrom
utfanalyzers

Conversation

@nowsprinting

Copy link
Copy Markdown
Owner

Summary

  • Replace the nunit.analyzers NuGet package with the UTF Analyzers package (com.nowsprinting.test-framework.analyzers) v1.4.2, which bundles NUnit.Analyzers plus Unity Test Framework-specific rules
  • Resolve the diagnostics it (and ReSharper) reports under Assets/

Changes

Packages / analyzer configuration

  • Remove the nunit.analyzers NuGet package
  • Install UTF Analyzers v1.4.2
  • Default.globalconfig
    • Enable UTF2006 (property lookup removable by managed code stripping) as warning, and remove link.xml
    • Demote UTF4004–UTF4007 to suggestion, since fixed-time waits and coroutine-style ([UnityTest] / [UnitySetUp]) tests are exactly what many examples demonstrate

Fixes

  • UTF4001: Add [Timeout] so condition waits fail fast instead of running for the 180-second default (UnityTestFrameworkVersionCheck, LogAssertExample, InputSystem ScenarioTest)
  • UTF2006: Restrict Has.Length / Has.Property examples in ConstraintExample to the Editor with [UnityPlatform], since link.xml no longer preserves the properties on the Player
  • ReSharper: remove redundant default initializers, default-valued arguments, explicit array types, an unused using, unused locals, and the unused UsingEventTriggerTest.GetScreenPoint

Suppressions (each with a reason comment)

  • UTF2001 / UTF2002 / UTF2003: [Ignore] / [Explicit] examples showing unsupported async usage
  • UTF2005: DelayedConstraint example; realtimeSinceStartup advances within the same frame
  • UTF4003: busy-wait loops in TimeoutAttributeExample / MaxTimeAttributeExample that intentionally exceed the time limit
  • ReSharper HeuristicUnreachableCode (LogAssertExample, driven by the Fail constant), Unity.UnknownResource (ResourcesExample, resources generated by IPrebuildSetup), CompareOfFloatsByEqualityOperator (NSubstituteJankenTest, exact literal argument check)

🤖 Generated with Claude Code

nowsprinting and others added 4 commits September 24, 2026 04:12
Upgrading UTF Analyzers surfaced errors that block compilation and warnings
that bury real findings in this example project.

- Add Timeout attributes so that condition waits fail fast instead of
  running for the 180-second default
- Restrict Has.Length/Has.Property tests to the Editor, since link.xml
  no longer preserves the looked-up properties on the Player
- Suppress, with reasons, diagnostics on code that intentionally
  demonstrates unsupported or discouraged patterns
- Demote UTF4004-UTF4007 to suggestion, since fixed-time waits and
  coroutine-style tests are what many of these examples demonstrate
- Fix redundant code reported by ReSharper inspections

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Code Metrics Report

master (0ec88ab) #45 (b87466b) +/-
Coverage 39.3% 39.0% -0.3%
Code to Test Ratio 1:4.0 1:4.0 +0.0
Test Execution Time 6m16s 6m27s +11s
Details
  |                     | master (0ec88ab) | #45 (b87466b) |  +/-  |
  |---------------------|------------------|---------------|-------|
- | Coverage            |            39.3% |         39.0% | -0.3% |
  |   Files             |               25 |            25 |     0 |
  |   Lines             |              478 |           476 |    -2 |
- |   Covered           |              188 |           186 |    -2 |
+ | Code to Test Ratio  |            1:4.0 |         1:4.0 |  +0.0 |
  |   Code              |             1255 |          1256 |    +1 |
+ |   Test              |             5071 |          5087 |   +16 |
- | Test Execution Time |            6m16s |         6m27s |  +11s |

Code coverage of files in pull request scope (4.5% → 2.8%, patch 0.0%)

Files Coverage +/- Patch Coverage Status
Assets/InputExample/Scripts/Runtime/FirstPersonControllerLegacy.cs 0.0% 0.0% - modified
Assets/InputSystemExample/Scripts/Runtime/FirstPersonController.cs 6.3% -2.0% - modified
Assets/InputSystemExample/Scripts/Runtime/GoalPlate.cs 0.0% -12.5% 0.0% modified

Reported by octocov

@nowsprinting
nowsprinting merged commit 246b555 into master Sep 26, 2026
13 checks passed
@nowsprinting
nowsprinting deleted the utfanalyzers branch September 26, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant